home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / UPDATE- Int&Libs 3.2 / CIncludes / MacLocales.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-25  |  5.5 KB  |  202 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        MacLocales.h
  3.  
  4.      Contains:    Types & prototypes for locale functions
  5.  
  6.      Version:    Technology:    Veronica
  7.                  Release:    Veronica Seed, Use with 3.2 Universal Interfaces
  8.  
  9.      Copyright:    © 1998-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __MACLOCALES__
  18. #define __MACLOCALES__
  19.  
  20. #ifndef __MACTYPES__
  21. #include <MacTypes.h>
  22. #endif
  23.  
  24.  
  25.  
  26. #if PRAGMA_ONCE
  27. #pragma once
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33.  
  34. #if PRAGMA_IMPORT
  35. #pragma import on
  36. #endif
  37.  
  38. #if PRAGMA_STRUCT_ALIGN
  39.     #pragma options align=mac68k
  40. #elif PRAGMA_STRUCT_PACKPUSH
  41.     #pragma pack(push, 2)
  42. #elif PRAGMA_STRUCT_PACK
  43.     #pragma pack(2)
  44. #endif
  45.  
  46. /*
  47.    -------------------------------------------------------------------------------------------------
  48.    ERROR/STATUS CODES
  49.    -------------------------------------------------------------------------------------------------
  50. */
  51.  
  52. enum {
  53.     kLocalesBufferTooSmallErr    = -30001,
  54.     kLocalesDefaultDisplayStatus = -30029                        /* Requested display locale unavailable, used default*/
  55. };
  56.  
  57. /*
  58.    -------------------------------------------------------------------------------------------------
  59.    TYPES & CONSTANTS
  60.    -------------------------------------------------------------------------------------------------
  61. */
  62.  
  63. typedef struct OpaqueLocaleRef*         LocaleRef;
  64. typedef UInt32                             LocalePartMask;
  65. enum {
  66.                                                                 /* bit set requests the following:*/
  67.     kLocaleLanguageMask            = 1L << 0,                        /* ISO 639-1 or -2 language code (2 or 3 letters)*/
  68.     kLocaleLanguageVariantMask    = 1L << 1,                        /* custom string for language variant*/
  69.     kLocaleScriptMask            = 1L << 2,                        /* ISO 15924 script code (2 letters)*/
  70.     kLocaleScriptVariantMask    = 1L << 3,                        /* custom string for script variant*/
  71.     kLocaleRegionMask            = 1L << 4,                        /* ISO 3166 country/region code (2 letters)*/
  72.     kLocaleRegionVariantMask    = 1L << 5,                        /* custom string for region variant*/
  73.     kLocaleAllPartsMask            = 0x0000003F                    /* all of the above*/
  74. };
  75.  
  76. typedef FourCharCode                     LocaleOperationClass;
  77. enum {
  78.     kUnicodeCollationClass        = FOUR_CHAR_CODE('ucol'),
  79.     kUnicodeTextBreakClass        = FOUR_CHAR_CODE('ubrk')
  80. };
  81.  
  82. typedef FourCharCode                     LocaleOperationVariant;
  83.  
  84. struct LocaleAndVariant {
  85.     LocaleRef                         locale;
  86.     LocaleOperationVariant             opVariant;
  87. };
  88. typedef struct LocaleAndVariant            LocaleAndVariant;
  89.  
  90. typedef UInt32                             LocaleNameMask;
  91. enum {
  92.                                                                 /* bit set requests the following:*/
  93.     kLocaleNameMask                = 1L << 0,                        /* name of locale*/
  94.     kLocaleOperationVariantNameMask = 1L << 1,                    /* name of LocaleOperationVariant*/
  95.     kLocaleAndVariantNameMask    = 0x00000003                    /* all of the above*/
  96. };
  97.  
  98. /*
  99.    -------------------------------------------------------------------------------------------------
  100.    FUNCTION PROTOTYPES
  101.    -------------------------------------------------------------------------------------------------
  102. */
  103.  
  104. /* Convert to or from LocaleRefs */
  105.  
  106. EXTERN_API_C( OSStatus )
  107. LocaleRefFromLangOrRegionCode    (LangCode                 lang,
  108.                                  RegionCode             region,
  109.                                  LocaleRef *            locale);
  110.  
  111. EXTERN_API_C( OSStatus )
  112. LocaleRefFromLocaleString        (const char *            localeString,
  113.                                  LocaleRef *            locale);
  114.  
  115. EXTERN_API_C( OSStatus )
  116. LocaleRefGetPartString            (LocaleRef                 locale,
  117.                                  LocalePartMask         partMask,
  118.                                  ByteCount                 maxStringLen,
  119.                                  char *                    partString);
  120.  
  121. /* Enumerate locales for a LocaleOperationClass */
  122.  
  123. EXTERN_API_C( OSStatus )
  124. LocaleOperationCountLocales        (LocaleOperationClass     opClass,
  125.                                  ItemCount *            localeCount);
  126.  
  127. EXTERN_API_C( OSStatus )
  128. LocaleOperationGetLocales        (LocaleOperationClass     opClass,
  129.                                  ItemCount                 maxLocaleCount,
  130.                                  ItemCount *            actualLocaleCount,
  131.                                  LocaleAndVariant         localeVariantList[]);
  132.  
  133. /* Get names for a locale*/
  134.  
  135. EXTERN_API_C( OSStatus )
  136. LocaleGetName                    (LocaleRef                 locale,
  137.                                  LocaleOperationVariant  opVariant,
  138.                                  LocaleNameMask         nameMask,
  139.                                  LocaleRef                 displayLocale,
  140.                                  UniCharCount             maxNameLen,
  141.                                  UniCharCount *            actualNameLen,
  142.                                  UniChar *                displayName);
  143.  
  144. EXTERN_API_C( OSStatus )
  145. LocaleCountNames                (LocaleRef                 locale,
  146.                                  LocaleOperationVariant  opVariant,
  147.                                  LocaleNameMask         nameMask,
  148.                                  ItemCount *            nameCount);
  149.  
  150. EXTERN_API_C( OSStatus )
  151. LocaleGetIndName                (LocaleRef                 locale,
  152.                                  LocaleOperationVariant  opVariant,
  153.                                  LocaleNameMask         nameMask,
  154.                                  ItemCount                 nameIndex,
  155.                                  UniCharCount             maxNameLen,
  156.                                  UniCharCount *            actualNameLen,
  157.                                  UniChar *                displayName,
  158.                                  LocaleRef *            displayLocale);
  159.  
  160. /* Get names for a LocaleOperationClass*/
  161.  
  162. EXTERN_API_C( OSStatus )
  163. LocaleOperationGetName            (LocaleOperationClass     opClass,
  164.                                  LocaleRef                 displayLocale,
  165.                                  UniCharCount             maxNameLen,
  166.                                  UniCharCount *            actualNameLen,
  167.                                  UniChar *                displayName);
  168.  
  169. EXTERN_API_C( OSStatus )
  170. LocaleOperationCountNames        (LocaleOperationClass     opClass,
  171.                                  ItemCount *            nameCount);
  172.  
  173. EXTERN_API_C( OSStatus )
  174. LocaleOperationGetIndName        (LocaleOperationClass     opClass,
  175.                                  ItemCount                 nameIndex,
  176.                                  UniCharCount             maxNameLen,
  177.                                  UniCharCount *            actualNameLen,
  178.                                  UniChar *                displayName,
  179.                                  LocaleRef *            displayLocale);
  180.  
  181.  
  182. #if PRAGMA_STRUCT_ALIGN
  183.     #pragma options align=reset
  184. #elif PRAGMA_STRUCT_PACKPUSH
  185.     #pragma pack(pop)
  186. #elif PRAGMA_STRUCT_PACK
  187.     #pragma pack()
  188. #endif
  189.  
  190. #ifdef PRAGMA_IMPORT_OFF
  191. #pragma import off
  192. #elif PRAGMA_IMPORT
  193. #pragma import reset
  194. #endif
  195.  
  196. #ifdef __cplusplus
  197. }
  198. #endif
  199.  
  200. #endif /* __MACLOCALES__ */
  201.  
  202.